<?

/*
Autor: Imanol Iglesias
email: imanolif@gmail.com
*/

define('URL_TWITTER_UPDATE', 'http://twitter.com/statuses/update.xml');
define('USER_AGENT_TWITTER', 'firefox');

include_once("request.php");


class MiniTwitter
{
	private $user;
	private $password;
	
	public function __construct($user, $password)
	{
		$this->user = $user;
		$this->password = $password;
	}
	
	public function update($status)
	{
		$request = new Request(URL_TWITTER_UPDATE);
		$request->setOpt(CURLOPT_RETURNTRANSFER, true);
		$request->setUserAgent(USER_AGENT_TWITTER);
		$request->setUserAuthentication($this->user, $this->password);	
		$request->setPOST('status='.$status);	
		$request->exec();
		
		//$request->getResult();
	}

}

/*
$tw = new MiniTwitter('user', 'pass');
$tw->update('probando API');
*/

?>